package com.bw.unit3.view.adapter

import android.content.Context
import android.graphics.Color
import android.widget.TextView
import com.bw.unit3.R
import com.bw.unit3.bean.TypeBean
import com.zhy.adapter.recyclerview.CommonAdapter
import com.zhy.adapter.recyclerview.base.ViewHolder

/**
 *
 * @ClassName: TypeAdapter
 * @Description: java类作用描述
 * @Author: zhangyanchao
 * @CreateDate: 2024/9/21 11:10 AM
 * @Version: 1.0
 */
class TypeAdapter(
    context: Context?, layoutId: Int, datas: List<TypeBean>?
) : CommonAdapter<TypeBean>(context, layoutId, datas) {
    override fun convert(holder: ViewHolder?, t: TypeBean?, position: Int) {
        val tv = holder?.getView<TextView>(R.id.tv_type)
        tv?.text = t?.category_name
        if (t?.isCheck == true) {
            tv?.setBackgroundColor(Color.RED)
        } else {
            tv?.setBackgroundColor(Color.GRAY)
        }
    }


}